<template>
  <div>
    <div class="main">
        <div class="block" v-for="(item, index) in addressList" :key="index">
            <div class="title">{{ item }}</div>
            <div class="list">
                <div v-for="(item2, index2) in list" :key="index2">
                    <div v-if="item2.address == item" class="agency">
                        <div class="name">{{ item2.name }}</div>
                        <div class="introduction">{{ item2.introduction }}</div>
                        <div class="phone">联系电话：{{ item2.phone }}</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
  </div>
</template>

<script>
import { getAddress,getAll } from '@/api/cooperation/cooperation';
export default {
    data(){
        return{
            addressList: [],
            list: [],
        }
    },
    methods: {
        getAddressList(){
            getAddress().then((res) => {
                if(res){
                    this.addressList = res.data;
                    console.log(this.addressList);
                }
            });
        },
        getList(){
            getAll().then((res) => {
                if(res){
                    this.list = res.data.flat();
                    console.log(this.list);
                }
            });
        },
    },
    mounted(){
        this.getAddressList();
        this.getList();
    }
}
</script>

<style lang="less" scoped>
.main{
    margin: 0 100px;
    // background-color: #fff;
}

.main .block .title{
    padding: 10px;
    font-size: 22px;
    // font-weight: bold;
    color: #444;
    background-color: rgb(240, 240, 240);
}
.main .block .list{
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    // width: 100%;
}
.main .block .list .agency{
    // width: 20%;
    margin: 10px;
    background-color: #fff;
    padding: 10px;
    width: 200px;
}
.main .block .list .agency .name{
    color: #444;
}
.main .block .list .agency .introduction{
    color: #666;
    font-size: 14px;
}
.main .block .list .agency .phone{
    color: #666;
    font-size: 14px;
    text-align: right;
}
</style>